# 给定一个double类型的浮点数base和int类型的整数exponent。求base的exponent次方。
# 保证base和exponent不都为0

# 要注意负指数的情况

def get_be(f_base, i_exponent):
    if f_base == 0.0 and i_exponent == 0:
        return 0
    elif i_exponent==0:
        return 1
    elif i_exponent == 1:
        return f_base
    else:
        temp = f_base
        isNag = False
        if i_exponent < 0:
            i_exponent = 0 - i_exponent
            isNag = True
        for i in range(2, i_exponent + 1):
            temp *= f_base

        if isNag:
            temp = 1/temp

        return temp


print(get_be(5.1, -3))
